/*
 * Wazuh Vulnerability scanner - Database Feed Manager
 * Copyright (C) 2015, Wazuh Inc.
 * Jun 14, 2023.
 *
 * This program is free software; you can redistribute it
 * and/or modify it under the terms of the GNU General Public
 * License (version 2) as published by the FSF - Free Software
 * Foundation.
 */

#ifndef _FEED_INDEXER_HPP
#define _FEED_INDEXER_HPP

#include "chainOfResponsability.hpp"
#include "eventContext.hpp"
#include "indexerConnector.hpp"

/**
 * @brief FeedIndexer class.
 *
 */
template<typename TIndexerConnector = IndexerConnector>
class FeedIndexer final : public AbstractHandler<std::shared_ptr<EventContext>>
{
private:
    std::shared_ptr<TIndexerConnector> m_indexerConnector; ///< Indexer connector.
public:
    /**
     * @brief Handles request and passes control to the next step of the chain.
     *
     * @param data Scan context.
     * @return std::shared_ptr<ScanContext> Abstract handler.
     */
    // TODO: Remove LCOV flags once the implementation of the 'Indexer Connector' module is completed
    // LCOV_EXCL_START
    std::shared_ptr<EventContext> handleRequest(std::shared_ptr<EventContext> data) override
    {
        return AbstractHandler<std::shared_ptr<EventContext>>::handleRequest(std::move(data));
    }

    /**
     * @brief Constructor.
     *
     * @param indexerConnector Indexer connector.
     */
    explicit FeedIndexer(std::shared_ptr<TIndexerConnector> indexerConnector)
        : m_indexerConnector(std::move(indexerConnector))
    {
    }
    // LCOV_EXCL_STOP
};

#endif // _FEED_INDEXER_HPP
